From 85215bb520b67bafbc196b2140a26c8c26ea4e4f Mon Sep 17 00:00:00 2001 From: robertl Date: Fri, 20 Oct 2006 19:30:45 +0000 Subject: [PATCH] KML changess: Don't use palettes for icons. That's sooo 2004. Add icons for realtime positioning. Color the auto depending on last position time relative to current time. Tweak reference files for test suite. --- gpsbabel/kml.c | 72 ++++++++++++++++++++------ gpsbabel/reference/earth-expertgps.kml | 31 +++-------- gpsbabel/reference/earth-gc.kml | 31 +++-------- 3 files changed, 68 insertions(+), 66 deletions(-) diff --git a/gpsbabel/kml.c b/gpsbabel/kml.c index 92a5e7fa8..41fa5f491 100644 --- a/gpsbabel/kml.c +++ b/gpsbabel/kml.c @@ -102,6 +102,16 @@ arglist_t kml_args[] = { ARG_TERMINATOR }; +static +struct { + int freshness; + char *icon; +} kml_tracking_icons[] = { + { 60, "http://maps.google.com/mapfiles/kml/pal4/icon15.png" }, // Red + { 30, "http://maps.google.com/mapfiles/kml/pal4/icon31.png" }, // Yellow + { 0, "http://maps.google.com/mapfiles/kml/pal4/icon62.png" }, // Green +}; + #define MYNAME "kml" #if ! HAVE_LIBEXPAT @@ -343,8 +353,7 @@ kml_write_xmle(const char *tag, const char *v) } #define hovertag(h) h ? 'h' : 'n' -static void kml_write_bitmap_style_(const char *style, int bitmap, - int x, int y, int width, int height, +static void kml_write_bitmap_style_(const char *style, const char * bitmap, int highlighted) { kml_write_xml(0,"\n", @@ -355,10 +364,7 @@ static void kml_write_bitmap_style_(const char *style, int bitmap, kml_write_xml(0, "1.2\n"); } kml_write_xml(1, "\n"); - kml_write_xml(0, "root://icons/bitmap-%d.png\n", bitmap); - kml_write_xml(0, "%d\n", x); - kml_write_xml(0, "%d\n", width); - kml_write_xml(0, "%d\n", height); + kml_write_xml(0, "%s\n", bitmap); kml_write_xml(-1, "\n"); kml_write_xml(-1, "\n"); kml_write_xml(-1, "\n"); @@ -368,11 +374,10 @@ static void kml_write_bitmap_style_(const char *style, int bitmap, * and non-highlighted version of the style to allow the icons * to magnify slightly on a rollover. */ -static void kml_write_bitmap_style(const char *style, int bitmap, - int x, int y, int width, int height) +static void kml_write_bitmap_style(const char *style, const char *bitmap) { - kml_write_bitmap_style_(style, bitmap, x, y, width, height, 0); - kml_write_bitmap_style_(style, bitmap, x, y, width, height, 1); + kml_write_bitmap_style_(style, bitmap, 0); + kml_write_bitmap_style_(style, bitmap, 1); kml_write_xml(1, "\n", style); kml_write_xml(1, "\n"); @@ -782,13 +787,15 @@ void kml_write(void) kml_write_xml(0, "GPS position\n"); else kml_write_xml(0, "GPS device\n"); - - kml_write_xml(0, "Created %s\n", import_time); + + if (now) { + kml_write_xml(0, "Created %s\n", import_time); + } // Style settings for bitmaps - kml_write_bitmap_style("route", 4, 160, 0, 32, 32); - kml_write_bitmap_style("track", 4, 128, 0, 32, 32); - kml_write_bitmap_style("waypoint", 4, 160, 0, 32, 32); + kml_write_bitmap_style("route", "http://maps.google.com/mapfiles/kml/pal4/icon61.png"); + kml_write_bitmap_style("track", "http://maps.google.com/mapfiles/kml/pal4/icon60.png"); + kml_write_bitmap_style("waypoint", "http://maps.google.com/mapfiles/kml/pal4/icon61.png"); // Style settings for line strings kml_write_xml(1, " @@ -19,10 +15,7 @@ 1.2 - root://icons/bitmap-4.png - 160 - 32 - 32 + http://maps.google.com/mapfiles/kml/pal4/icon61.png @@ -40,10 +33,7 @@ @@ -52,10 +42,7 @@ 1.2 - root://icons/bitmap-4.png - 128 - 32 - 32 + http://maps.google.com/mapfiles/kml/pal4/icon60.png @@ -73,10 +60,7 @@ @@ -85,10 +69,7 @@ 1.2 - root://icons/bitmap-4.png - 160 - 32 - 32 + http://maps.google.com/mapfiles/kml/pal4/icon61.png diff --git a/gpsbabel/reference/earth-gc.kml b/gpsbabel/reference/earth-gc.kml index 9861e21cc..e7c301f8b 100644 --- a/gpsbabel/reference/earth-gc.kml +++ b/gpsbabel/reference/earth-gc.kml @@ -2,15 +2,11 @@ GPS device - Created Wed Dec 31 18:00:00 1969 @@ -19,10 +15,7 @@ 1.2 - root://icons/bitmap-4.png - 160 - 32 - 32 + http://maps.google.com/mapfiles/kml/pal4/icon61.png @@ -40,10 +33,7 @@ @@ -52,10 +42,7 @@ 1.2 - root://icons/bitmap-4.png - 128 - 32 - 32 + http://maps.google.com/mapfiles/kml/pal4/icon60.png @@ -73,10 +60,7 @@ @@ -85,10 +69,7 @@ 1.2 - root://icons/bitmap-4.png - 160 - 32 - 32 + http://maps.google.com/mapfiles/kml/pal4/icon61.png -- 2.30.2